package org.academic.texteditor.gui.plugin.style;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.JMenu;
import javax.swing.KeyStroke;
import javax.swing.text.AttributeSet;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;

import org.academic.texteditor.gui.component.menu.MenuFactory;
import org.academic.texteditor.gui.plugin.AbstractSelectionPlugin;

public class ItalicPlugin extends AbstractSelectionPlugin {

	private static final long serialVersionUID = -2659447476036874849L;

	public ItalicPlugin() {
		super("italicPlugin");
	}

	@Override
	protected String getMenuItemKey() {
		return "menu.format.italic";
	}

	@Override
	protected String getMenuItemName() {
		return "italic";
	}

	@Override
	protected KeyStroke getAcceleratorKey() {
		return KeyStroke.getKeyStroke(KeyEvent.VK_I, ActionEvent.CTRL_MASK);
	}
	
	@Override
	protected JMenu getParentMenu() {
		return MenuFactory.getFormat();
	}
	
	@Override
	protected AttributeSet getOffAttributeSet() {
		return new SimpleAttributeSet();
	}

	@Override
	protected SimpleAttributeSet getOnAttributeSet() {
		SimpleAttributeSet attributeSet = new SimpleAttributeSet();
		attributeSet.addAttribute(StyleConstants.Italic, true);
		return attributeSet;
	}

}
